<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	<style type="text/css">
		#dan{
			position: absolute;
			top: 60px;
		}
		
	</style>
<script type="text/javascript">
	
window.onload = function(){
	
	var btn = document.getElementById("btn");
	var dan =document.getElementById("dan");
	var speed = 10;
//	给按钮加单击事件
	btn.onclick = function(){
		
		var speed = 1;
		setInterval(function(){
//			speed++;
			speed = speed*1.05;
//			获得旧值
			var old_left = dan.style.left;
//			计算新值
			var new_left = parseInt(old_left)+speed;
//			将新值赋值回去
			dan.style.left = new_left+'px';
		},40)
		
	}
	
}
	
</script>
	</head>
	<body>
		
	<input type="button" value="走你~~~" id="btn" />
	<br /><br />
	<img src="dan.gif" id="dan" style="left: 0px;" />
		
	</body>
</html>
